package com.eulog.client.trump;


public class TrumpHuman {
	protected double startingMoney;
	protected double currentMoney;
	protected int count;
	protected int won;
	protected int lost;
	protected final int ID;
	protected static int lastID = 0;
	
	private TrumpHandCards handCard;
	
	public TrumpHuman(int money) {
		ID = lastID;
		lastID ++;
		
		handCard = new TrumpHandCards();
		init(money);

	}
	
	public void init(int money) {
		startingMoney = currentMoney = money;
		count = won = lost = 0;
	}
	
	public int getID() {return ID;}
	public double getStartingMoney() {return startingMoney;}
	public double getCurrentMoney() {return currentMoney;}
	public void clearCard() {handCard.clear();}
	public void addHandCard(TrumpCard card) {handCard.add(card);}
	//public void addMoney(double m) {currentMoney+=m;}
	
	public void register(double prize) {
		// Zero prize means tie
		count++;
		currentMoney+=prize;
		if(prize>0) won++;
		else if(prize<0) lost++;
	}
	
	public void wonAgainst(TrumpHuman againstHuman,double prize) {
		register(prize);
		againstHuman.register(-1*prize);
	}
	
	public void tieAgainst(TrumpHuman againstHuman) {
		register(0);
		againstHuman.register(0);
	}
	
	public void lostAgainst(TrumpHuman againstHuman,double prize) {
		register(-1*prize);
		againstHuman.register(prize);
	}
	
	public void setHandCard(TrumpHandCards newHandCard) {handCard = newHandCard;}
	
}
